location / {
    rewrite ^/$ $1{{ iiab_home_url }};
}

location /usb {
    alias /library/www/html/local_content/;
    fancyindex on;    # autoindex on;
    add_before_body /upload2usb/upload-simple.php;
}

location ~ ^/upload2usb/(.*)\.php$ {
    fastcgi_request_buffering off;
    client_max_body_size      2G;
    client_body_buffer_size   512K;
    client_body_timeout       3600;
    fastcgi_read_timeout      3600;
    send_timeout              3600;

    alias /library/www/html/upload2usb/$1.php;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    fastcgi_pass php;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    include fastcgi_params;
}

location /local_content/ {
    fancyindex on;    # autoindex on;
    add_before_body /upload2usb/upload-simple.php;
}

location /info {
    fancyindex on;    # Directory listing for http://box/info/admin-console/
    fancyindex_exact_size off;  # Output human-readable file sizes.
}

location /modules/ {
    fancyindex on;              # Enable fancy indexes.
    fancyindex_exact_size off;  # Output human-readable file sizes.
    fancyindex_ignore index.htmlf rachel-index.php;
}

location /js-menu/ {
    fancyindex on;    # autoindex on;
    location /js-menu/menu-files/js/ {
        fancyindex off;    # autoindex off;
    }
    location /js-menu/menu-files/services/ {
        fancyindex off;    # autoindex off;
    }
}

location /software/ {
    fancyindex on;              # Enable fancy indexes.
    fancyindex_exact_size off;  # Output human-readable file sizes.
    location ~* \.(apk)$ {
        add_header Content-Type application/vnd.android.package-archive;
    }

    location ~* \.(zim)$ {
        add_header Content-Type application/zip;
    }
}
